[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Procedures
Pascal allows you to create procedures. A procedure is a type of
subprogram and has a syntax nearly identical to that of programs, with
one major exception: A procedure starts with a PROCEDURE header, which
takes the form:
procedure <name><parameters>;
where <name> is any legal identifier not previously declared, and
<parameters> is an optional list of parameters, enclosed in
parentheses and separated by semicolons. (The other difference between
a program and a procedure is that the main body of a procedure ends
with a semicolon instead of a period.)
A procedure is executed by referencing its name, including any
necessary parameters. For example, if you declare this procedure:
procedure Swap(var A,B : Integer);
var
T : Integer;
begin
T := A;
A := B;
B := T
end;
then you can call it in your program like this (assuming I and J are
integer variables):
Swap(I,J);
See Also:
parameters
subprograms
functions
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson